package com.zdp.item.mapper;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * @author sesshomaru
 * @date 2021/7/10 16:57
 */
@Repository
public interface ItemsSpecMapperCustom {

    // 添加库存(总库存+1、剩余库存+1)
    int addStock(@Param("itemSpecId")String itemSpecId, @Param("number")Integer number);

    //下单冻结库存(剩余库存-1、冻结库存+1)
    int freezeStockFromRemain(@Param("itemSpecId")String itemSpecId, @Param("number")Integer number);

    // 取消订单释放冻结库存(剩余库存+1、冻结库存-1)
    int unFreezeStockToRemain(@Param("itemSpecId")String itemSpecId, @Param("number")Integer number);

    // 支付完成扣减冻结库存(已售库存+1、冻结库存-1)
    int reduceFreezeStock(@Param("itemSpecId")String itemSpecId, @Param("number")Integer number);
}
